-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support client-only initialization and more #28
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add support to pass an object as initAction, specifying a part that should run prepared and a part that should only be executed on the client. Update the existing spec to make sure unit test still pass
Create a IsomorphicTestEnvironment utility that can be used in integration tests to simulate a component rendering on the server first and then on the client. This can be used to test more complex situations. Create 2 sample integration tests using the new utility. This file is named .test.js to distinguish from the unit tests, which are named .spec.js Create an ExtendableError utility to create custom error classes. Use this to create a custom error type PrepareValidationError. This can be used to assert that a prepare validation error has occured in tests (as opposed to another type of error). Add the babel-plugin-transform-builtin-extend plugin to make sure we can extend the builtin Error correctly.
Allow to run the integration tests separately from the unit tests for faster test development
Fix nested it testing blocks. They are not valid jest
Because initComponent is now called from both willMount and didMount, we need to make sure that the initAction is only called from one of these hooks
Add an update function to IsomorphicTestEnvironment. This will make sure allow us to re-render the test renderer with new components.
Use the fixture component instead of rewriting a component every time
Check that component has been prepared should not be done when initAction === null (clientOnly init action)
Instead of writing the whole JSON for actions dispatched, use snapshot testing. This improves readability in the unit test files
All store test state is static, so we can move it to a fixture file to save some space in the unit test files
Log a warning on redundant calls to prepareComponent() when the component only has client-side initialization
Changed the server-side render in IsomorphicTestEnvironment to react-dom/server renderToStaticMarkup(). This is to prevent didMount hooks from being called. Create integration test that includes both prepared and clientOnly actions Fixed wording in unit test description.
ThaNarie
requested review from
ThaNarie
and removed request for
mediamonks-arjan
December 6, 2018 13:31
Included the clientOnly change to withInitAction docs Updated formatting and styling of the docs Temporarily changed the theme to a forked version to fix a charset issue
ThaNarie
approved these changes
Dec 12, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR:
New features should be backwards compatible.